home *** CD-ROM | disk | FTP | other *** search
- Path: nntp.teleport.com!usenet
- From: GHouck <hksys@teleport.com>
- Newsgroups: comp.lang.c
- Subject: Re: Passing to C prog from Dos Prompt
- Date: 17 Apr 1996 04:51:13 GMT
- Organization: systems hk
- Message-ID: <4l1tc1$ibj@nadine.teleport.com>
- References: <4l0qei$gj9@soap.news.pipex.net>
- NNTP-Posting-Host: ip-pdx16-41.teleport.com
- Mime-Version: 1.0
- Content-Type: text/plain; charset=us-ascii
- Content-Transfer-Encoding: 7bit
- X-Mailer: Mozilla 1.22 (Windows; I; 32bit)
-
- unregistered@dial.pipex.com (ZXCV) wrote:
- >i apologise if this question has done the rounds before,
- >as I haven't got the time to check all 1500 odd articles.
- >
- >basically, I want to pass some parameters to a program from DOS
- >eg, for the program IDLP :
- >
- >C:\>IDLP /?
- >C:\>IDLP test.dlt
- >
- >This is annoying as i had the routinew for this but seem to have lost
- >it. ARRGH!
- >
- >ZXCV.
-
- You should use the command-line arguments provided by the OS, i.e.:
-
- int main( int argc, char *argv[] )
- {
- int i;
-
- for( i=1; i<argc; i++ ) { /* argv[0] is usually the program file */
-
- printf( "\nArg %d = %s",i,argv[i] );
- }
-
- You are given an array of pointers to characters (*argv[]), and the number
- of them (argc), for all white-space-delimited command-line arguments
- present when the executable is invoked.
-
- Yours, Geoff Houck
-
-